<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="../study/js/vue.js"></script>
</head>
<body>
  <div id="box">
   <img :src="img">
    <button v-on:click="btn">点我切换图片</button>


  </div>
<script>
      var vm=new Vue({

        el:'#box',
        data:{
            img:'img/1.jpg'

        },
        methods: {
          btn(){
             if(this.img=='img/1.jpg'){
                 this.img='img/2.jpg'
             }else {
                 this.img='img/1.jpg'
             }

          }
        }

      })
</script>
</body>
</html>